home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / dev / misc / egs.lha / EGS / EGS_Devels / Examples / EGS_Requester / EventLoop.c next >
Text File  |  1993-02-17  |  4KB  |  141 lines

  1. /*
  2. **  Author: Markus van Kempen
  3. **  Date  : 18. Dezember 1992
  4. **          09 Jan 1993 mvk
  5. **/
  6.  
  7.  
  8.  
  9. BOOL HandleEvents(struct EI_Window *fenster)
  10. {
  11.  BOOL              raus = FALSE;         /* TRUE, if close gadget is pressed*/
  12.  ULONG             GetBits,WaitBits;     /* MessagePort bits */
  13.  EI_EIntuiMsgPtr   imess;                /* Message structure pointer */
  14.  ER_FileRequestPtr freq;
  15.  int               id;
  16.  
  17.  freq = ER_CreateFileReq(NULL);
  18.  
  19.  WaitBits = (1L <<  fenster->UserPort->mp_SigBit) | SIGBREAKF_CTRL_C;
  20.  
  21.  while (!raus)
  22.  {
  23.   GetBits = Wait(WaitBits);
  24.  
  25.   if (GetBits & SIGBREAKF_CTRL_C) /* CTRL-C  */
  26.   {
  27.         raus = TRUE;
  28.   }
  29.  
  30.   while ((imess = (struct EI_EIntuiMsg *)GetMsg(fenster->UserPort)) != NULL)
  31.   {
  32.  
  33.         switch (imess->Class)
  34.         {
  35.  
  36.           case  EI_iGADGETUP:
  37.                     printf("Gadget \n");
  38.                     id = ((struct EI_Gadget *)imess->IAddress)->GadgetID;
  39.                     ReplyMsg((struct Message *)imess);
  40.                     printf("id = %4lx \n", id);
  41.                     EI_SleepWindow(Window);
  42.  
  43.                     switch (id)
  44.                     {              /* Record */
  45.                         case 0x1000:
  46.                                    printf("Recording\n");
  47.                                    myMSG(" |     Recording    | STOP ? | ");
  48.                                    break;
  49.  
  50.                                    /* Play   */
  51.                         case 0x1001:
  52.                                    myMSG(" | Ready with playing data ! | ");
  53.                                    break;
  54.  
  55.                                    /* Load   */
  56.                         case 0x1002:
  57.  
  58.                      dummy = ER_DoRequest((ER_RequestPtr)freq);
  59.  
  60. /*
  61.                     if (freq->Name != NULL)
  62.                         myLoad(freq->Name,freq->Path);
  63. */
  64.  
  65.                      break;
  66.  
  67.                                    /* Save   */
  68.                         case 0x1003:
  69.  
  70.                      dummy = ER_DoRequest((ER_RequestPtr)freq);
  71. /*
  72.  
  73.                      if (freq->Name != NULL)
  74.                         mySave(freq->Name,freq->Path);
  75. */
  76.                                   break;
  77.                         case 0x1100:
  78.                                   break;
  79.                     }
  80.                     EI_WakeWindow(Window);
  81.  
  82.                     break;
  83.  
  84.    case EI_iCLOSEWINDOW:
  85.  
  86.                   printf("iClose\n");
  87.     raus = TRUE;
  88.  
  89.     ReplyMsg ((struct Message *)imess);
  90.     break;
  91.  
  92.           case EI_iMENUPICK:
  93.  
  94.                     printf("iMenu\n");
  95.                     printf("Code = %lx\n",imess->Code);
  96.                     /*
  97.  
  98.                         switch(imess->Code)
  99.                         {
  100.  
  101.                         }
  102.  
  103.  
  104.                      */
  105.                     ReplyMsg ( (struct Message *)imess );
  106.                     break;
  107.  
  108.           case EI_iSIZEVERIFY:
  109.                  printf("VerifySizing ! \n");
  110.  
  111.                  EI_RemoveGList(fenster,con->First,con->Num);
  112.  
  113.                  EB_DeleteGadContext(con);
  114.                  ReplyMsg ( (struct Message*)imess );
  115.           break;
  116.  
  117.           case EI_iNEWSIZE:
  118.                  printf("Sizing ! \n");
  119.                  EI_LockIntuition();
  120.  
  121.                  fenster=(struct EI_Window *)CreateGads((EI_WindowPtr)fenster);
  122.                  EI_AddGList(fenster,con->First,con->Num);
  123.  
  124.                  EI_UnlockIntuition();
  125.                  ReplyMsg ( (struct Message*)imess );
  126.            break;
  127.  
  128.  
  129.          default:
  130.                   printf (" Unknown message %ld & %d\n ",imess->Class,imess->Code);
  131.                   ReplyMsg((struct Message *)imess);
  132.  
  133.         }
  134.   }
  135.  }
  136.  
  137.  ER_DeleteRequest((ER_RequestPtr)freq);
  138.  return raus;
  139. }
  140.  
  141.